// boostEnvDemo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <boost\date_time\date.hpp>
#include <boost\date_time\posix_time\posix_time.hpp>
#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
/**********************
         YYY
***********************/

int _tmain(int argc, _TCHAR* argv[])
{
	using namespace boost::gregorian;
	using namespace boost::posix_time;
	date d(2002,Feb,1); //an arbitrary date 
	ptime t1(d, hours(5)); //date + time of day offset 
	ptime t2 = t1 - minutes(4)+seconds(2);
	ptime now = second_clock::local_time(); //use the clock 
	date today = now.date(); //Get the date part out of the time 
	date tomorrow = today + date_duration(1);
	ptime tomorrow_start(tomorrow); //midnight 

	//input streaming 
	std::stringstream ss("2004-Jan-1 05:21:33.20");
	ss >> t2;

	//starting at current time iterator adds by one hour
	time_iterator titr(now,hours(1)); 
	for (; titr < tomorrow_start; ++titr) {
		std::cout << (*titr) << std::endl;
	}
	system("PAUSE");
	return 0;
}

